#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
    double year, n;
    scanf("%lf%lf", &year, &n);
    if (year < 5)
    {
        if (n <= 40)
            printf("%.2lf", 30 * n);
        else
            double n1 = 1200 + 45 * (year - 40);
        printf("%.2lf", n1);
    }
    else
    {
        if (n <= 40)
            printf("%.2lf", 50 * n);
        else
        {
            double n1 = 2000 + 75 * (year - 40);
            printf("%.2lf", n1);
        }
    }

    return 0;
}